'use strict';

module.exports = app => {
  const { router, controller: { houseInfo }, middleware: { validator, checkPageTable, checkParams } } = app;
  // const userExist = app.middleware.userExist();
  const baseUrl = '/api/houseInfo';
  router.get(baseUrl + '/my', checkPageTable(), houseInfo.indexMy);
  router.get(baseUrl + '/shops', checkPageTable(), houseInfo.indexShops);
  router.get(baseUrl + '/examine', checkPageTable(), houseInfo.indexExamine);
  router.patch(baseUrl + '/device', houseInfo.editDevice);
  router.patch(baseUrl + '/advantage', houseInfo.editAdvantage);
  router.patch(baseUrl + '/agree', validator('common.checkId'), houseInfo.agree);
  router.patch(baseUrl + '/disagree', validator('common.checkId'), houseInfo.disagree);
  router.get(baseUrl, checkPageTable(), houseInfo.index);
  router.get(baseUrl + '/:id', checkParams(), houseInfo.show);
  router.put(baseUrl + '/:id', checkParams(), validator('houseInfo.update'), houseInfo.update);
};
